/******Don't forget to download*****
*****GRAPHICAL DATA FILE STRUCTURE*****
*****A approach to learn DFS Graphically*****
Only @  http://www.vivekpatel.cjb.net        */

//Shell Sort

#include <iostream.h>
#include <conio.h>

void shellsort(int arr[],int n){
	int gap=n/2,swap;
	do{
	   do{
	     swap=0;
	     for(int i=0;i<n-gap;i++)
	     {
		if(arr[i] > arr[i+gap]){
		   int temp = arr[i];
		       arr[i]= arr[i+gap];
		       arr[i+gap]=temp;
		       swap=1;
		   }
	     }
	   }while(swap);
	}while(gap=gap/2);
}

void main(){
	int arr[10],i;
	clrscr();
	cout<<"Enter 10 numbers : ";
	for(i=0;i<10;i++)
	  cin>>arr[i];
	shellsort(arr,10);
	cout<<"\n\nAfter sort : ";
	for(i=0;i<10;i++)
	  cout<<arr[i]<<" ";
	getch();
}
